package zy1208.zy18;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.lang.reflect.Field;
import java.util.List;

public class demo {
    public static void main(String[] args) throws Exception {
        List<String> list = FileUtils.readLines(new File("D:\\ideadashuju12\\liu_ya_kai\\src\\zy1208\\zy18\\data1.txt"));
        for (String s : list) {
            Class<?> aClass = Class.forName(s);
            Object o = aClass.newInstance();
            List<String> lines = FileUtils.readLines(new File("D:\\ideadashuju12\\liu_ya_kai\\src\\zy1208\\zy18\\data2.txt"));
            for (String line : lines) {
                Field f = aClass.getDeclaredField(line.split("=")[0]);
                try {
                    f.set(o,line.split("=")[1]);
                } catch (IllegalArgumentException e) {
                    f.set(o,Integer.parseInt(line.split("=")[1]));
                }
                System.out.println(f.get(o));
            }
        }
    }
}
